gdk_region_destroy (damage);
}
+static GdkDrawable *
+get_real_drawable (GdkOffscreenWindow *offscreen)
+{
+ GdkPixmapObject *pixmap;
+ pixmap = (GdkPixmapObject *) offscreen->pixmap;
+ return GDK_DRAWABLE (pixmap->impl);
+}
+
static void
gdk_offscreen_window_draw_drawable (GdkDrawable *drawable,
GdkGC *gc,
gint height)
{
GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable);
- GdkDrawable *real_drawable = GDK_DRAWABLE (offscreen->pixmap);
+ GdkDrawable *real_drawable = get_real_drawable (offscreen);
gdk_draw_drawable (real_drawable, gc,
src, xsrc, ysrc,
gint height)
{
GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable);
- GdkDrawable *real_drawable = GDK_DRAWABLE (offscreen->pixmap);
+ GdkDrawable *real_drawable = get_real_drawable (offscreen);
gdk_draw_rectangle (real_drawable,
gc, filled, x, y, width, height);
gint angle2)
{
GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable);
- GdkDrawable *real_drawable = GDK_DRAWABLE (offscreen->pixmap);
+ GdkDrawable *real_drawable = get_real_drawable (offscreen);
gdk_draw_arc (real_drawable,
gc,
gint npoints)
{
GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable);
- GdkDrawable *real_drawable = GDK_DRAWABLE (offscreen->pixmap);
+ GdkDrawable *real_drawable = get_real_drawable (offscreen);
gdk_draw_polygon (real_drawable,
gc,
gint text_length)
{
GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable);
- GdkDrawable *real_drawable = GDK_DRAWABLE (offscreen->pixmap);
+ GdkDrawable *real_drawable = get_real_drawable (offscreen);
GdkWindowObject *private = GDK_WINDOW_OBJECT (offscreen->wrapper);
gdk_draw_text (real_drawable,
gint text_length)
{
GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable);
- GdkDrawable *real_drawable = GDK_DRAWABLE (offscreen->pixmap);
+ GdkDrawable *real_drawable = get_real_drawable (offscreen);
GdkWindowObject *private = GDK_WINDOW_OBJECT (offscreen->wrapper);
gdk_draw_text_wc (real_drawable,
gint npoints)
{
GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable);
- GdkDrawable *real_drawable = GDK_DRAWABLE (offscreen->pixmap);
+ GdkDrawable *real_drawable = get_real_drawable (offscreen);
gdk_draw_points (real_drawable,
gc,
gint nsegs)
{
GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable);
- GdkDrawable *real_drawable = GDK_DRAWABLE (offscreen->pixmap);
+ GdkDrawable *real_drawable = get_real_drawable (offscreen);
gdk_draw_segments (real_drawable,
gc,
gint npoints)
{
GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable);
- GdkDrawable *real_drawable = GDK_DRAWABLE (offscreen->pixmap);
+ GdkDrawable *real_drawable = get_real_drawable (offscreen);
GdkWindowObject *private = GDK_WINDOW_OBJECT (offscreen->wrapper);
gdk_draw_lines (real_drawable,
gint height)
{
GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable);
- GdkDrawable *real_drawable = GDK_DRAWABLE (offscreen->pixmap);
+ GdkDrawable *real_drawable = get_real_drawable (offscreen);
gdk_draw_image (real_drawable,
gc,
gint y_dither)
{
GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable);
- GdkDrawable *real_drawable = GDK_DRAWABLE (offscreen->pixmap);
+ GdkDrawable *real_drawable = get_real_drawable (offscreen);
gdk_draw_pixbuf (real_drawable,
gc,
{
GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+ _gdk_gc_remove_drawable_clip (gc);
gdk_draw_rectangle (private->impl, gc, filled,
x, y, width, height);
}
{
GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+ _gdk_gc_remove_drawable_clip (gc);
gdk_draw_arc (private->impl, gc, filled,
x, y,
width, height, angle1, angle2);
{
GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+ _gdk_gc_remove_drawable_clip (gc);
gdk_draw_polygon (private->impl, gc, filled, points, npoints);
}
{
GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+ _gdk_gc_remove_drawable_clip (gc);
gdk_draw_text (private->impl, font, gc,
x, y, text, text_length);
}
{
GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+ _gdk_gc_remove_drawable_clip (gc);
gdk_draw_text_wc (private->impl, font, gc,
x, y, text, text_length);
}
{
GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+ _gdk_gc_remove_drawable_clip (gc);
gdk_draw_drawable (private->impl, gc, src, xsrc, ysrc,
xdest, ydest,
width, height);
{
GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+ _gdk_gc_remove_drawable_clip (gc);
gdk_draw_points (private->impl, gc, points, npoints);
}
{
GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+ _gdk_gc_remove_drawable_clip (gc);
gdk_draw_segments (private->impl, gc, segs, nsegs);
}
{
GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+ _gdk_gc_remove_drawable_clip (gc);
gdk_draw_lines (private->impl, gc, points, npoints);
}
{
GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+ _gdk_gc_remove_drawable_clip (gc);
gdk_draw_glyphs (private->impl, gc, font, x, y, glyphs);
}
{
GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+ _gdk_gc_remove_drawable_clip (gc);
gdk_draw_glyphs_transformed (private->impl, gc, matrix, font, x, y, glyphs);
}
{
GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+ _gdk_gc_remove_drawable_clip (gc);
gdk_draw_image (private->impl, gc, image, xsrc, ysrc, xdest, ydest,
width, height);
}
{
GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+ _gdk_gc_remove_drawable_clip (gc);
gdk_draw_pixbuf (private->impl, gc, pixbuf,
src_x, src_y, dest_x, dest_y, width, height,
dither, x_dither, y_dither);
{
GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+ _gdk_gc_remove_drawable_clip (gc);
gdk_draw_trapezoids (private->impl, gc, trapezoids, n_trapezoids);
}
GdkRectangle r;
GList *l;
GdkWindowObject *child;
- GdkRegion *new_clip;
+ GdkRegion *new_clip, *old_clip_region_with_children;
gboolean clip_region_changed;
gboolean abs_pos_changed;
int old_abs_x, old_abs_y;
if (private->clip_region)
gdk_region_destroy (private->clip_region);
private->clip_region = new_clip;
- private->clip_tag = new_region_tag ();
+ old_clip_region_with_children = private->clip_region_with_children;
private->clip_region_with_children = gdk_region_copy (private->clip_region);
remove_child_area (private, NULL, private->clip_region_with_children);
+
+ if (clip_region_changed ||
+ !gdk_region_equal (private->clip_region_with_children, old_clip_region_with_children))
+ private->clip_tag = new_region_tag ();
+
+ if (old_clip_region_with_children)
+ gdk_region_destroy (old_clip_region_with_children);
}
/* Update all children, recursively. */
setup_clip_for_paint (drawable, paint, gc, old_clip_x, \
old_clip_y);
-#define RESTORE_PAINT_GC_CLIP(gc) \
- if (paint->uses_implicit) \
- _gdk_gc_remove_drawable_clip (gc);
+#define RESTORE_PAINT_GC_CLIP(gc)
#define SETUP_DIRECT_GC_CLIP(gc) \
gdk_window_flush_implicit_paint ((GdkWindow *)drawable);\
setup_clip_for_draw (drawable, gc, old_clip_x, old_clip_y);
-#define RESTORE_DIRECT_GC_CLIP(gc) \
- _gdk_gc_remove_drawable_clip (gc);
+#define RESTORE_DIRECT_GC_CLIP(gc)
static GdkGC *
gdk_window_create_gc (GdkDrawable *drawable,
values, mask);
}
+/* After having set up the drawable clip rect on a GC we need
+ * to make sure that if we draw to a pixmap we draw to the impl,
+ * otherwise the pixmap code will reset the drawable clip.
+ */
+static GdkDrawable *
+pixmap_impl (GdkPixmap *pixmap)
+{
+ return ((GdkPixmapObject *)pixmap)->impl;
+}
+
static void
gdk_window_draw_rectangle (GdkDrawable *drawable,
GdkGC *gc,
{
GdkWindowPaint *paint = private->paint_stack->data;
SETUP_PAINT_GC_CLIP (gc);
- gdk_draw_rectangle (paint->pixmap, gc, filled,
+ gdk_draw_rectangle (pixmap_impl (paint->pixmap), gc, filled,
x - x_offset, y - y_offset, width, height);
RESTORE_PAINT_GC_CLIP (gc);
}
{
GdkWindowPaint *paint = private->paint_stack->data;
SETUP_PAINT_GC_CLIP (gc);
- gdk_draw_arc (paint->pixmap, gc, filled,
+ gdk_draw_arc (pixmap_impl (paint->pixmap), gc, filled,
x - x_offset, y - y_offset,
width, height, angle1, angle2);
RESTORE_PAINT_GC_CLIP (gc);
{
GdkWindowPaint *paint = private->paint_stack->data;
SETUP_PAINT_GC_CLIP (gc);
- gdk_draw_polygon (paint->pixmap, gc, filled, new_points, npoints);
+ gdk_draw_polygon (pixmap_impl (paint->pixmap), gc, filled, new_points, npoints);
RESTORE_PAINT_GC_CLIP (gc);
}
else
{
GdkWindowPaint *paint = private->paint_stack->data;
SETUP_PAINT_GC_CLIP (gc);
- gdk_draw_text (paint->pixmap, font, gc,
+ gdk_draw_text (pixmap_impl (paint->pixmap), font, gc,
x - x_offset, y - y_offset, text, text_length);
RESTORE_PAINT_GC_CLIP (gc);
{
GdkWindowPaint *paint = private->paint_stack->data;
SETUP_PAINT_GC_CLIP (gc);
- gdk_draw_text_wc (paint->pixmap, font, gc,
+ gdk_draw_text_wc (pixmap_impl (paint->pixmap), font, gc,
x - x_offset, y - y_offset, text, text_length);
RESTORE_PAINT_GC_CLIP (gc);
}
{
GdkWindowPaint *paint = private->paint_stack->data;
SETUP_PAINT_GC_CLIP (gc);
- gdk_draw_drawable (paint->pixmap, gc,
+ gdk_draw_drawable (pixmap_impl (paint->pixmap), gc,
src, xsrc, ysrc,
xdest - x_offset, ydest - y_offset, width, height);
{
GdkWindowPaint *paint = private->paint_stack->data;
SETUP_PAINT_GC_CLIP (gc);
- gdk_draw_points (paint->pixmap, gc, new_points, npoints);
+ gdk_draw_points (pixmap_impl (paint->pixmap), gc, new_points, npoints);
RESTORE_PAINT_GC_CLIP (gc);
}
else
{
GdkWindowPaint *paint = private->paint_stack->data;
SETUP_PAINT_GC_CLIP (gc);
- gdk_draw_segments (paint->pixmap, gc, new_segs, nsegs);
+ gdk_draw_segments (pixmap_impl (paint->pixmap), gc, new_segs, nsegs);
RESTORE_PAINT_GC_CLIP (gc);
}
else
{
GdkWindowPaint *paint = private->paint_stack->data;
SETUP_PAINT_GC_CLIP (gc);
- gdk_draw_lines (paint->pixmap, gc, new_points, npoints);
+ gdk_draw_lines (pixmap_impl (paint->pixmap), gc, new_points, npoints);
RESTORE_PAINT_GC_CLIP (gc);
}
else
GdkWindowPaint *paint = private->paint_stack->data;
SETUP_PAINT_GC_CLIP (gc);
- gdk_draw_glyphs (paint->pixmap, gc, font, x - x_offset, y - y_offset, glyphs);
+ gdk_draw_glyphs (pixmap_impl (paint->pixmap), gc, font, x - x_offset, y - y_offset, glyphs);
RESTORE_PAINT_GC_CLIP (gc);
}
else
GdkWindowPaint *paint = private->paint_stack->data;
SETUP_PAINT_GC_CLIP (gc);
- gdk_draw_glyphs_transformed (paint->pixmap, gc, matrix, font, x, y, glyphs);
+ gdk_draw_glyphs_transformed (pixmap_impl (paint->pixmap), gc, matrix, font, x, y, glyphs);
RESTORE_PAINT_GC_CLIP (gc);
}
else
{
GdkWindowPaint *paint = private->paint_stack->data;
SETUP_PAINT_GC_CLIP (gc);
- gdk_draw_image (paint->pixmap, gc, image, xsrc, ysrc,
+ gdk_draw_image (pixmap_impl (paint->pixmap), gc, image, xsrc, ysrc,
xdest - x_offset, ydest - y_offset,
width, height);
{
GdkWindowPaint *paint = private->paint_stack->data;
SETUP_PAINT_GC_CLIP (gc);
- gdk_draw_pixbuf (paint->pixmap, gc, pixbuf, src_x, src_y,
+ gdk_draw_pixbuf (pixmap_impl (paint->pixmap), gc, pixbuf, src_x, src_y,
dest_x - x_offset, dest_y - y_offset,
width, height,
dither, x_dither - x_offset, y_dither - y_offset);
{
GdkWindowPaint *paint = private->paint_stack->data;
SETUP_PAINT_GC_CLIP (gc);
- gdk_draw_trapezoids (paint->pixmap, gc, trapezoids, n_trapezoids);
+ gdk_draw_trapezoids (pixmap_impl (paint->pixmap), gc, trapezoids, n_trapezoids);
RESTORE_PAINT_GC_CLIP (gc);
}
else